package com.project.webpage.controller;


import com.project.webpage.aop.TagLog;
import com.project.webpage.dto.BaseParam;
import com.project.webpage.dto.ClwParam;
import com.project.webpage.dto.SearchByRqParam;
import com.project.webpage.dto.XlzdParam;
import com.project.webpage.service.CzjczXlStateService;
import com.project.webpage.util.RestResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/webpage/czjcz/xl/")
public class CzjczXlStateController extends BaseController {

    @Resource
    CzjczXlStateService czjczXlStateService;

    /**
     * 企业车载链路数据查询
     */
    @PostMapping("state/page")
    @TagLog(operation = 0, content = "查询企业车载链路数据列表")
    public RestResult page() {
        BaseParam param = new BaseParam();
        this.getPage(false, param);
        return RestResult.ok(czjczXlStateService.getListForPage(param));
    }

    /**
     * 企业车载链路数据详细查询
     */
    @PostMapping("state/detail")
    @TagLog(operation = 0, content = "查询企业车载链路数据详细列表")
    public RestResult detail(@RequestBody SearchByRqParam param) {
        this.getPage(false, param);
        return RestResult.ok(czjczXlStateService.getCzxlListForPage(param));
    }

    /**
     * 车载终端接收实时统计查询
     */
    @PostMapping("state/total")
    @TagLog(operation = 0, content = "查询车载终端接收实时统计")
    public RestResult total() {
        BaseParam param = new BaseParam();
        this.getPage(false, param);
        return RestResult.ok(czjczXlStateService.getSsTotal(param));
    }

    /**
     * 线路状态
     */
    @PostMapping("state")
    @TagLog(operation = 5, content = "查询线路状态")
    public RestResult state(@RequestBody XlzdParam param) {
        this.getPage(false, param);
        return RestResult.ok(czjczXlStateService.getCzxlForPage(param));
    }


    /**
     * 线路车辆轨迹
     */
    @PostMapping("clw/page")
    @TagLog(operation = 5, content = "查询线路车辆轨迹")
    public RestResult state(@RequestBody ClwParam param) {
        this.getPage(false, param);
        return RestResult.ok(czjczXlStateService.getClwForPage(param));
    }
}
